﻿@{
    ViewBag.Title = "Index";
}
<link href="~/Content/css/framework-theme.css" rel="stylesheet" />
<link href="~/Content/select2/select2.min.css" rel="stylesheet" />
<script src="~/Content/select2/select2.min.js"></script>

@this.RefStyle("~/Content/webuploader/webuploader.css")
@this.RefScript("~/Content/webuploader/webuploader.js")
@Html.Partial("Index_js")
<style type="text/css">
        /*
    .img_thum {max-width:100px;}*/
</style>
<style type="text/css">
    #picker {
        display: inline-block;
        line-height: 10px;
        vertical-align: middle;
        margin: 0 12px 0 0;
    }

    .img_thum {
        width: 100px;
        margin-right: 5px;
    }

    .img_red {
        border: 1px solid #ff6a00;
    }

    #thelist {
        overflow-y: hidden;
        overflow-x: scroll;
    }
</style>
<div style="width:100%;">
    <div class="topPanel">
        <div class="toolbar">
            <a class="a-btn-refresh" onclick="$ace.reload()"></a>
            <button class="a-btn-edit" data-bind="click:edit,disable:!dataTable.selectedModel()">修改</button>
            <button class="a-btn-add" data-bind="click:add">添加</button>
             
            <button class="a-btn-delete" data-bind="click:del,disable:!dataTable.selectedModel()">删除</button>
        </div>
        <div class="search">
            <table class="form-table" style="width:auto;">
                <tr>                    
                    <td style="width:100px;">
                        <select class="a-control" id="ST" name="ST" data-bind="options:_sts,optionsText:'Title',optionsValue:'Id',optionsCaption:'--选择分类--',value:searchModel().ST">
                            <option value="0">--选择状态--</option>
                        </select>
                    </td>
                    <td>
                        <input type="text" class="a-control" placeholder="请输入要查询关键字" style="width: 200px;" data-bind="value:searchModel().keyword">
                    </td>
                    <td>
                        <button type="button" class="a-btn-search" data-bind="click:search"></button>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div>
        <table class="table table-hover" data-bind="with:dataTable">
            <thead>
                <tr>
                    <th style="width:20px;"></th>
                    <th>活动名称</th> 
                    <th>订单金额上限</th>
                    <th>减免金额</th>
                    <th>活动有效期</th>
                    <th>状态</th>
                    <th>发布时间</th>
                </tr>
            </thead>
            <tbody data-bind="foreach:models">
                <tr data-bind="click:$parent.selectRow">
                    <td data-bind="text:Id"></td>
                    <td data-bind="text:Title"></td>
                    <td data-bind="text:MaxLimit"></td>
                    <td data-bind="text:CutPrice"></td>
                    <td><span data-bind="dateString:Date1"></span>~<span data-bind="dateString:Date2"></span> </td>
                    <td data-bind="text:$ace.findName(_sts,ST(),'Id','Title')"></td>
                    <td data-bind="dateString:CreateDate"></td>
                </tr>
            </tbody>
            @Html.Partial("_tfoot")
        </table>
    </div>
</div>

<dialogbox data-bind="with:dialog" style="width:80%;">
    <form id="form1">
        <div class="content-tabs">
            <nav class="page-tabs menuTabs">
                <div class="page-tabs-content" style="margin-left: 0px;">
                    <a href="javascript:;" class="menuTab active">活动信息</a>
                    <a href="javascript:;" class="menuTab">关联产品</a>
                </div>
            </nav>
        </div>
        <div class="pro_tab">
            <input name="Id" id="hid_id" type="hidden" class="a-control required" placeholder="" data-bind="value:model().Id" />
            <table class="form-table">
                <tbody>
                    <tr>
                        <td class="form-title">活动名称</td>
                        <td class="form-value"><input name="Title" type="text" class="a-control required" placeholder="" data-bind="value:model().Title" /></td>
                    </tr>

                    <tr>
                        <td class="form-title">订单金额上限</td>
                        <td class="form-value"><input name="MaxLimit" type="text" class="a-control required" placeholder="" data-bind="value:model().MaxLimit" /></td>
                    </tr>
                    <tr>
                        <td class="form-title">减免金额</td>
                        <td class="form-value"><input name="CutPrice" type="text" class="a-control required" placeholder="" data-bind="value:model().CutPrice" /></td>
                    </tr>
                    <tr>
                        <td class="form-title">活动时间</td>
                        <td class="form-value">
                            <input name="Date1" type="text" class="a-control Wdate" placeholder="" data-bind="dateString:model().Date1" style="width:50%;" />
                            <input name="Date2" type="text" class="a-control Wdate" placeholder="" data-bind="dateString:model().Date2" style="width:50%;" />
                        </td>
                    </tr>
                    <tr>
                        <td class="form-title">状态</td>
                        <td class="form-value">
                            <select class="a-control" data-bind="options:_sts,optionsText:'Title',optionsValue:'Id',optionsCaption:'--选择分类--',value:model().ST"></select>
                        </td>
                    </tr>

                </tbody>
            </table>
        </div>
        <div class="pro_tab" style="display:none;">
            <table class="form-table">
                <tr>
                    <td class="form-title">搜索</td>
                    <td class="form-value">
                        <select name="ProSortID" id="ProSortID" type="text" class="a-control required" data-bind="options:_sorts2,optionsText:'Title',optionsValue:'Id',optionsCaption:'--选择分类--',value:model().ProSortID" style="width:50%;"></select>
                        <select class="a-control required" id="SelProduct" style="width:50%;"></select>
                    </td>
                </tr>
                <tr>
                    <td class="form-title">活动产品</td>
                    <td class="form-value">
                        <input name="ProductID" id="SelProductID" type="text" class="a-control required" placeholder=""  style="width:50%;" />
                        <input name="ProductName" id="SelProductName" type="text" class="a-control required" placeholder=""  style="width:50%;" />
                      
                    </td>
                </tr>
                <tr>
                    <td class="form-title"></td>
                    <td class="form-value">
                        <a class="a-btn-info" id="btn_add_product" >添加</a>

                    </td>
                </tr>
            </table>
            <table class="table table-hover">
                <thead>
                    <tr>
                        <th>产品编号</th>
                        <th>产品名称</th> 
                        <th></th>
                    </tr>
                </thead>
                <tbody id="paylog">

                </tbody>
            </table>
        </div>

        



    </form>
</dialogbox>

<script type="text/javascript">
    jQuery(function () {
        jQuery(".menuTab").click(function () {
            var i = jQuery(this).index();

            jQuery(".menuTab").removeClass("active");
            jQuery(this).addClass("active");

            jQuery(".pro_tab").hide();
            jQuery(".pro_tab").eq(i).show();
        });
    });
    
</script>
